<?php
class XLog4YaxLogger implements XLogger{
	protected $appenders = array();
	protected $level = ALL;

	/**
	 * 
	 */
	public function level() {
		return $this->level;	
	}

	/**
	 * @param $level
	 * @return XLog4YaxLogger
	 */
	public function setLevel($level) {
		$this->level = $level;
		return $this;
	}

	/**
	 * @param $name
	 * @param $appender
	 * @return XLog4YaxLogger
	 */	
	public function addAppender($name, XLog4YaxAppender $appender){
		$this->appenders[$name] = $appender;
		return $this;
	}
	
	public function log(XLoggingEvent $event){
		if($this->level > $event->getLevel()){
			return false;
		}
		foreach($this->appenders as $this->appender){
			$this->appender->append($event);
		}
		return true;
	}
}
?>